<?php
session_start();
require('../conn.php');
require('../functions.php');
require('../QueryList.class.php');
require('admin.php');

$row=$mysql->query("select * from version order by id desc limit 1");

if ($_POST) {
      $version_id=guolv($_POST['varsion_id']);
      $version_ms=guolv($_POST["version_ms"]);
      $force=guolv($_POST['force']);
       $share=guolv($_POST['share']);
       $wuseplug=guolv($_POST['wuseplug']);
       $ssharetype=guolv($_POST['ssharetype']);
       $suseplug=guolv($_POST['suseplug']);
       $packgeurl=guolv($_POST['packgeurl']);
       $plugpackgename=guolv($_POST['plugpackgename']);
       $row=$mysql->execute("insert into version VALUES(null,$version_id,'$version_ms','$force','$share','$wuseplug','$suseplug','$packgeurl','$plugpackgename','$ssharetype')");
       if($row){
             echo "<script>location.href=location;</script>";
       }else{
           echo $mysql->error();
           exit;
       }
}

?>




<?php include('head.php') ?>

<div class="container-fluid">

    <div class="row-fluid">
        <?php
        include('left.php'); ?>
        <div class="span10">
            <h1 class="page-title">版本信息</h1>
            <!--
            <div class="btn-toolbar">
                <a href="#myModal" data-toggle="modal" class="btn">Delete</a>
              <div class="btn-group">
              </div>
            </div>
            -->
            <div class="well">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="tab" action="version.php" method="post">
                            <label>版本号</label>
                            <input type="text" placeholder="版本号" value="<?php echo $row[0]['version'] ?>" name="varsion_id" />
                            <label>版本描述</label>
                            <input  id="type" name="version_ms" value="<?php echo $row[0]['desc'] ?>" type="text" placeholder="版本描述" />

                            <label>是否强制更新</label>
                            <select  name="force" >
                                <?php   $force=$row[0]['force_e'];   if($force=='false'){
                                    echo "<option value=\"true\" >是</option><option value=\"false\" selected = \"selected\" >否</option>";

                                }else{
                                    echo "<option value=\"true\" selected = \"selected\" >是</option><option value=\"false\" >否</option>";
                                } ?>

                            </select>
                            <label>文章是否分享到微信</label>
                            <select  name="share" >
                                <?php  if($row[0]['share']==1){
                                    echo "<option value=\"1\" selected = \"selected\" >是</option><option value=\"0\" >否</option>";
                                }else{ echo "<option value=\"1\" >是</option><option value=\"0\" selected = \"selected\" >否</option>";}?>

                            </select>
                            <label>文章是否用助手分享</label>
                            <select  name="wuseplug" >
                                <?php  if($row[0]['wuseplug']==1){
                                    echo "<option value=\"1\" selected = \"selected\" >是</option><option value=\"0\" >否</option>";
                                }else{ echo "<option value=\"1\" >是</option><option value=\"0\" selected = \"selected\" >否</option>";}?>

                            </select>
                            <label>收徒是否分享到微信</label>
                            <select  name="ssharetype" >
                                <?php  if($row[0]['ssharetype']==1){
                                    echo "<option value=\"1\" selected = \"selected\" >是</option><option value=\"0\" >否</option>";
                                }else{ echo "<option value=\"1\" >是</option><option value=\"0\" selected = \"selected\" >否</option>";}?>

                            </select>
                            <label>收徒是否用助手分享</label>
                            <select  name="suseplug" >
                                <?php  if($row[0]['suseplug']==1){
                                    echo "<option value=\"1\" selected = \"selected\" >是</option><option value=\"0\" >否</option>";
                                }else{ echo "<option value=\"1\" >是</option><option value=\"0\" selected = \"selected\" >否</option>";}?>

                            </select>
														 <label>分享助手下载网址</label>
                            <input  id="type" name="packgeurl" value="<?php echo $row[0]['packgeurl'] ?>" type="text" placeholder="分享助手下载网址" />
                             <label>分享助手的包名</label>
                            <input  id="type" name="plugpackgename" value="<?php echo $row[0]['plugpackgename'] ?>" type="text" placeholder="分享助手的包名" />
                            <label></label>
                            <button class="btn btn-primary"><i class="icon-save"></i> 提交</button>
                        </form>
                    </div>
                    <div class="tab-pane fade" id="profile">
                        <form id="tab2">
                            <label>New Password</label>
                            <input type="password" class="input-xlarge">
                            <div>
                                <button class="btn btn-primary">Update</button>
                            </div>
                        </form>
                    </div>
                </div>

            </div>

            <div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                 aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Delete Confirmation</h3>
                </div>
                <div class="modal-body">

                    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete
                        the user?</p>
                </div>
                <div class="modal-footer">
                    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
                    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
                </div>
            </div>
        </div>
    </div>
</div>

<footer>
    <hr>
    <p class="pull-right"><!--power by right--></p>
    <p><!--power by --></p>
</footer>


<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="lib/bootstrap/js/bootstrap.js"></script>


</body>
</html>